#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <stack>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#define status int
#define TRUE 1
#define FALSE 0
#define NORMAL 2

using namespace std;
typedef struct Node{
	int num;//数字
	struct Node* next;
}List,*LinkList;

typedef struct Clause{
	LinkList L;
	int length = 0;//从句长度
	struct Clause* next;
}Clause,*LinkClause;

typedef struct result{
	bool ans;
}*Result,R;

typedef struct Cell{
	int x;
	int y;
	int val;
}Cell;
#pragma pack()

LinkClause init(char filename[]);
status IsNULL(LinkClause C);
status IsEmptyList(LinkClause C);
LinkClause FindSingleClause(LinkClause C);
LinkClause AddSingleClause(LinkClause C,int num);
void DeleteNode(LinkClause C,int num);
LinkClause copy(LinkClause C);
LinkList replicate(LinkList l);
void show(bool* result);
int returnN();
status DPLL(LinkClause C,bool* result);
status AdvancedDPLL(LinkClause C, bool* result);
int SingleSpread(LinkClause C, bool* result);
void Print(LinkClause C);
void AddHead(LinkClause C);
LinkClause DeleteClause(LinkClause C,LinkClause cur);
void FirstRow(int a[]);
int RestRows(int a[9][9],int i,int j);
void CreateSK(int a[9][9]);
void showSK(int a[9][9]);
void holes(int a[9][9]);
void suduku2sat(int a[9][9],int emptynum);
void judge(char filename[], char suffix1[], char suffix2[]);
void play();
void SKplay(int a[9][9]);
void checka(int a[9][9]);
void freeList(LinkClause C);
void SimplifyClause(LinkClause C, int num);
LinkClause AdvancedCopy(LinkClause C);
void CreateXSK(int a[9][9]);
int X_RestRows(int a[9][9], int i, int j);
void playX();
void X_suduku2sat(int a[9][9], int emptynum);
void XSKplay(int a[9][9]);